package com.nulstudio.emotion.text.exception;

import org.springframework.lang.NonNull;

/**
 * Enumeration for exception code and message.
 * @author nullsty
 * @since 2.0
 */
public enum NulExceptionConstants {
    INVALID_TOKEN(1, "Token 无效"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    JWT_SECRET_MISSING(10002, "JWT Secret 未找到"),
    ROLE_NOT_EXIST(10003, "用户组不存在"),
    USER_NOT_EXIST(10004, "用户不存在"),
    WRONG_PASSWORD(10005, "密码错误"),
    INVALID_INVITE_CODE(10006, "邀请码无效"),
    EXPIRED_INVITE_CODE(10007, "邀请码已过期"),
    INVITE_CODE_USED_UP(10008, "邀请码已使用完"),
    INVITE_CODE_BLOCKED(10009, "邀请码被冻结"),
    ROLE_BLOCKED(10010, "用户组被冻结"),
    USER_ALREADY_EXIST(10011, "已经存在这个用户"),
    INVALID_GENDER(10012, "无效的性别"),
    INVALID_EXPIRE_DATE(10013, "无效的过期时间"),
    MODEL_LOAD_ERROR(11000, "获取模型输出失败"),
    INVALID_DELETE_HISTORY_REQUEST(11001, "无效的删除请求")
    ;

    /**
     * Error code.
     */
    private final int code;

    /**
     * Error message, connot be null.
     */
    @NonNull
    private final String message;

    /**
     * Inner initializer for this enumeration.
     * @param code error code
     * @param message error message, must not be null
     */
    NulExceptionConstants(int code, @NonNull String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * Get error code.
     * @return error code
     */
    public int getCode() {
        return code;
    }

    /**
     * Get error message.
     * @return error message, not null.
     */
    @NonNull
    public String getMessage() {
        return message;
    }
}
